﻿using System.Collections.Generic;
using ESoft.Core.Initialize;
using ESoft.Core.Logging;
using Microsoft.EntityFrameworkCore;

namespace ESoft.Core.DataAccess
{
    public class DataContext : DbContext
    {
        private readonly Logging.ILogger logger = LogManager.GetLogger(typeof(DataContext));

        public DataContext(DbContextOptions<DataContext> options):base(options)
        {
          
        }
      
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            ////注册实体配置信息
            ICollection<IEntityMappingConfiguration> entityMappers = DatabaseInitializer.EntityMappers;
            foreach (IEntityMappingConfiguration mapper in entityMappers)
            {
                mapper.Map(modelBuilder);
            }
        }
    }
}
